(function(){
    publicParam.salarySize = 20;
    /**
    * 初始化
    */
	async function init(){
        if (!checkConnect()) return;
        var rtn = await loadManbers();
        if (rtn){
            if (!publicParam.salaryList){
                setLoading(1);
                publicParam.salaryNum = await numOfSalary();
                setLoading(0);
            }
            if(!publicParam.salaryPage) publicParam.salaryPage = 0;
            //如果提案数多于每页显示的数量，则显示分页按钮
            if(publicParam.salaryNum>publicParam.salarySize){
                var param = {
                    total:publicParam.salaryNum,
                    size:publicParam.salarySize,
                    current:publicParam.salaryPage,
                    fn:load,
                };
                loadPage("/common/paging","paging",param);
            }
            load(publicParam.salaryPage);
            getNode("refresh").onclick = ()=>{
                //强制刷新
                publicParam.salaryList = null;
                publicParam.salaryPage = 0;
                init();
            }
        }
    }
    /**
    * 为了分页每次载入一定量的薪酬
    */
	async function load(paging){
        setLoading(1);
        publicParam.proposalsPage = paging;
        publicParam.salaryList = await getSalaryFromTo();
        loadPage("/salary/listItem","list");
        setLoading(0);
    }
	init();
})();